/*
 * @Descripttion: 
 * @version: 
 * @Author: 高月飞
 * @Date: 2023-11-15 23:50:57
 * @LastEditors: 高月飞
 * @LastEditTime: 2023-11-15 23:51:30
 */
// 判断是否为空对象
export const isEmptyObj = (obj: object) => {
    return Object.keys(obj).length === 0 ? true : false
}

// 返回非空的对象属性
// export const noEmptySearchObject = (obj: any) => {
const noEmptySearchObject = <T extends object>(obj: T) => {
    // let ret = {}
    let ret = {} as T
    for (let key in obj) {
        // 它当前有值
        if (obj[key]) {
            // (ret as any)[key] = obj[key]
            ret[key] = obj[key]
        }
    }
    return isEmptyObj(ret) ? null : ret
}
export default noEmptySearchObject